#include "CPlayer.h"

CPlayer::CPlayer(int color)
{
    type = color;
}
CPlayer::~CPlayer()
{
}
void CPlayer::Set(CBoard b)
{
    cout << "请玩家" << type << "输入坐标" << endl;
    int prow, pcol;
    cin >> prow >> pcol;
    prow--,pcol--;
    while (b.board[prow][pcol] !=0 )
    {
         cout << "此节点处有棋子，请重新输入" << endl;
          cin >> prow >> pcol;
          prow--,pcol--;
    }
        Piece p=Piece();
        p.row = prow;
        p.column = pcol;
        playerlist.push_front(p);
}

void CPlayer::Remove(CBoard b)
{
    cout << "输入要移除棋子" << endl;
    int prow, pcol;
    cin >> prow >> pcol;
    b.board[prow][pcol] = 0;
    playerlist.pop_front();
}

int CPlayer::GetRow()
{
    int row = playerlist.front().row;
    return row;
}

int CPlayer::GetColumn()
{
    int column = playerlist.front().column;
    return column;
}
